<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户信息管理系统</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-2.1.0.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
        td, th {
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <h3 style="text-align: center">用户信息列表</h3>
    <table border="1" class="table table-bordered table-hover">
        <tr class="success">
            <th>编号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>籍贯</th>
            <th>QQ</th>
            <th>邮箱</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${pageBean.dataList}" var="user">
            <tr>
                <td>${user.id}</td>
                <td>${user.name}</td>
                <td>${user.sex}</td>
                <td>${user.age}</td>
                <td>${user.address}</td>
                <td>${user.qq}</td>
                <td>${user.email}</td>
                <td><a class="btn btn-default btn-sm" href="update.jsp">修改</a>&nbsp;<a class="btn btn-default btn-sm" href="">删除</a></td>
            </tr>
        </c:forEach>

        <tr>
            <td colspan="8" align="center">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <%--首页和上一页--%>
                        <c:if test="${pageBean.pageNumber>1}">
                            <li>
                                <a href="pageQuery?pageNumber=1&pageSize=5" aria-label="Previous">
                                    <span aria-hidden="true">首页</span>
                                </a>
                            </li>
                            <li>
                                <a href="pageQuery?pageNumber=${pageBean.pageNumber-1}&pageSize=5" aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                        </c:if>

                        <%--页码--%>
                        <c:forEach var="i" begin="1" end="${pageBean.pageCount}" step="1">
                            <li class="${pageBean.pageNumber==i?"active":""}">
                                <a href="pageQuery?pageNumber=${i}&pageSize=5">${i}</a>
                            </li>
                        </c:forEach>

                        <%--下一页和末页--%>
                        <c:if test="${pageBean.pageNumber < pageBean.pageCount}">
                            <li>
                                <a href="pageQuery?pageNumber=${pageBean.pageNumber+1}&pageSize=5" aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                            <li>
                                <a href="pageQuery?pageNumber=${pageBean.pageCount}&pageSize=5" aria-label="Next">
                                    <span aria-hidden="true">末页</span>
                                </a>
                            </li>
                        </c:if>
                    </ul>
                </nav>
            </td>
        </tr>
    </table>
</div>
</body>
</html>